<?php

declare(strict_types=1);

namespace Dreamcat\ApiDocTest\TestCases;

use Dreamcat\ApiDoc\Popo\ApiDefinition;
use Dreamcat\ApiDoc\Popo\BodyDefinition;
use PHPUnit\Framework\TestCase;

/**
 * 测试popo的个别方法
 * @author vijay
 */
class PopoTest extends TestCase
{
    public function testApiDefGetter()
    {
        $api = new ApiDefinition();
        $body = new BodyDefinition();
        $body->setField(uniqid("field-"));
        $api->addGetDefinition($body);
        self::assertNull($api->getGetDefine("test"));
        self::assertEquals(spl_object_id($body), spl_object_id($api->getGetDefine($body->getField())));

        $body = new BodyDefinition();
        $body->setField(uniqid("path-"));
        $api->addPathVariableDefinition($body);
        self::assertNull($api->getPathVariableDefinition("test"));
        self::assertEquals(spl_object_id($body), spl_object_id($api->getPathVariableDefinition($body->getField())));
    }
}

# end of file
